﻿// <copyright>
// Copyright (c) 2008 - 2009, Microsoft, All Rights Reserved
// </copyright>
//
// Licensed under the Microsoft Public License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at 
//
// http://www.opensource.org/licenses/ms-pl.html

namespace LiveLabs.Logging.Logs
{
    using System;
    using System.Diagnostics.CodeAnalysis;

    /// <summary>
    /// An implementation of <see cref="Log"/> that does not log, and cannot be
    /// made to log.
    /// </summary>
    public class NullLog : Log
    {
        /// <summary>
        /// Singleton instance of the no operation log
        /// </summary>
        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "Instance can't be changed")]
        public static readonly NullLog Instance = new NullLog();

        private NullLog()
        {
        }

        /// <summary>
        /// Gets or sets a value indicating whether not this Log should log.
        /// </summary>
        /// <remarks>
        /// This implementation of <see cref="Log"/> ignores setting this property and always returns false.
        /// </remarks>
        public override bool IsLogging
        {
            get { return false; }
            set { }
        }

        /// <summary>
        /// Does nothing.  No operation.
        /// </summary>
        /// <param name="message">The message to log</param>
        /// <param name="level">The <see cref="LogLevel"/> of the message.</param>
        public override void WriteLine(string message, LogLevel level)
        {
        }
    }
}
